package com.woniuxy.house.provider;

import com.woniuxy.house.entity.HouseDetail;
import com.woniuxy.house.entity.HousePictures;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;
@Slf4j
public class HousePicturesSqlProvider {
    public String update(HousePictures housePictures) {
        String sql = new SQL() {
            {
                UPDATE("house_detail");
                if (housePictures.getName()!= null) {
                    SET("name=#{name}");
                }
                if (housePictures.getPicture()!= null) {
                    SET("picture=#{picture}");
                }
                if (housePictures.getSource()!= null) {
                    SET("source_id=#{source.id}");
                }
                WHERE("id=#{id}");
            }
        }.toString();
        log.debug("sql:{}",sql);
        return sql;
    }
}
